<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //1 模板字符串 `${变量}`
    // 2 repeat 函数
    let str = "abc";
    console.log(str.repeat(3)); //abcabcabc
    console.log(str)
    //3 includes 函数
    console.log(str.includes("a")); //true
    console.log(str.includes("d")); //false
    console.log(str.includes("a",1)); //false 从索引1开始查找
    //空字符串是所有字符串的子集
    console.log(str.includes("")); //true
    //4 startsWith 函数  元素是否在字符串开头
    console.log(str.startsWith("a")); //true
    console.log(str.startsWith("b")); //false
    console.log(str.startsWith("a",1)); //false 从索引1开始查找
    //5 endsWith 函数 第二个参数，表示针对前几个字符
    console.log(str.endsWith("c")); //true
    console.log(str.endsWith("d")); //false
    console.log(str.endsWith("c",2)); //true 
</script>
</html>